const fs = require('fs');

// 读取文本文件并解析数据
const rawData = fs.readFileSync('data.txt', 'utf-8');
const rows = rawData.split('\n').filter(row => row.trim() !== '');

const newData = rows.map(row => {
  // 解析数据
  const cells = row.split('|').map(cell => cell.trim());

  // 处理数据
  const lastCell = cells.pop();
  cells.unshift(lastCell);

  // 构造新行
  return cells.join('\t');
});

// 将结果写入新的文本文件
fs.writeFileSync('new-data.txt', newData.join('\n'));
